package my;

import my.tree.BST;
import my.tree.BinaryTree;
import my.printer.BinaryTrees;

/**
 * <p>
 *
 * </p>
 *
 * @author AJun
 * @since 2020/8/13
 */
public class Main07 {

    public static void main(String[] args) {
        test1();
    }

    static void test1() {
        Integer[] data = {7, 4, 9, 2, 5, 8, 11, 3, 12, 1};

        BST<Integer> bst = new BST<>();
        for (Integer n : data) bst.add(n);

        BinaryTrees.println(bst);
        bst.inorder(new BinaryTree.Visitor<Integer>() {
            @Override
            public boolean visit(Integer element) {
                System.out.print(element + "\t");
                return false;
            }
        });
        System.out.println("\n\n");
        bst.remove(7);
        BinaryTrees.println(bst);
        bst.inorder(new BinaryTree.Visitor<Integer>() {
            @Override
            public boolean visit(Integer element) {
                System.out.print(element + "\t");
                return false;
            }
        });
    }

}
